/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package fr.uniscol.dao.impl;

import java.sql.ResultSet;
import java.sql.SQLException;
import org.springframework.dao.DataAccessException;

/**
 *
 * @author Christophe
 */
public class JDBCUtils {
 
    public static String getStringIfExists(ResultSet rs, String columnName){
        String ret = null;
        try{
            ret = rs.getString(columnName);
            
        }catch(SQLException e){
            ret = null;
        }
        return ret;
    }
    
    public static int getIntIfExists(ResultSet rs, String columnName){
        int iRet = -1;
        
        try{
            iRet = rs.getInt(columnName);
            
        }catch(SQLException e){
            iRet = -1;
        }
        
        return iRet;
    }        
}
